<jsp:useBean id="db" scope="session" class="com.jipl.Masters.DatabaseBean"/>
<jsp:setProperty name="db" property="*"/>  
<%@ page import="java.io.* , java.util.*, java.sql.*, com.jipl.login.*, com.jipl.Masters.*"%>
<%db.connect();

if (request.getParameter("Delete")!=null)
{
request.getSession(true);
String piddel=session.getAttribute("pid").toString();

String del="delete from purchase where pid='"+piddel+"'";
System.out.print(del);
int i1=db.updateSQL(del);

String delstock="delete from stock where purchase_id='"+piddel+"'";
System.out.print(delstock);
int i2=db.updateSQL(delstock);

if (i1>0 && i2>0)
out.println("<script language='javascript'>alert('Purchse Invoice Deleted!....');</script>");
else 
out.println("<script language='javascript'>alert('Deletion of Purchase Invoice is Not possible Due to already in use!....');</script>");

%><jsp:forward page="deletePurchase.jsp"/><%
}
%>
